1 module windows_impl;
2 import windows;
3 alias size_t = windows.size_t;//conflict with object.size_t
4 
5 extern (System):
6 //C       static  void *Ptr32ToPtr(const void *p) { return (void *) (ULONG_PTR) p; }
7 struct _N10
8 {
9     DWORD __bitfield1;
10     DWORD BaseMid() { return (__bitfield1 >> 0) & 0xff; }
11     DWORD Type() { return (__bitfield1 >> 8) & 0x1f; }
12     DWORD Dpl() { return (__bitfield1 >> 13) & 0x3; }
13     DWORD Pres() { return (__bitfield1 >> 15) & 0x1; }
14     DWORD LimitHi() { return (__bitfield1 >> 16) & 0xf; }
15     DWORD Sys() { return (__bitfield1 >> 20) & 0x1; }
16     DWORD Reserved_0() { return (__bitfield1 >> 21) & 0x1; }
17     DWORD Default_Big() { return (__bitfield1 >> 22) & 0x1; }
18     DWORD Granularity() { return (__bitfield1 >> 23) & 0x1; }
19     DWORD BaseHi() { return (__bitfield1 >> 24) & 0xff; }
20 }
21 struct _N15
22 {
23     DWORD __bitfield1;
24     DWORD RatePercent() { return (__bitfield1 >> 0) & 0x7f; }
25     DWORD Reserved0() { return (__bitfield1 >> 7) & 0x1ffffff; }
26 }
27 union _RATE_QUOTA_LIMIT
28 {
29     DWORD RateData;
30     DWORD RatePercent() { return 0x7f; }
31     DWORD Reserved0() { return 0x1ffffff; }
32 }
33 struct _PROCESSOR_POWER_POLICY_INFO
34 {
35     DWORD TimeCheck;
36     DWORD DemoteLimit;
37     DWORD PromoteLimit;
38     BYTE DemotePercent;
39     BYTE PromotePercent;
40     BYTE [2]Spare;
41     DWORD __bitfield1;
42     DWORD AllowDemotion() { return (__bitfield1 >> 0) & 0x1; }
43     DWORD AllowPromotion() { return (__bitfield1 >> 1) & 0x1; }
44     DWORD Reserved() { return (__bitfield1 >> 2) & 0x3fffffff; }
45 }
46 struct _PROCESSOR_POWER_POLICY
47 {
48     DWORD Revision;
49     BYTE DynamicThrottle;
50     BYTE [3]Spare;
51     DWORD __bitfield1;
52     DWORD DisableCStates() { return (__bitfield1 >> 0) & 0x1; }
53     DWORD Reserved() { return (__bitfield1 >> 1) & 0x7fffffff; }
54     DWORD PolicyCount;
55     PROCESSOR_POWER_POLICY_INFO [3]Policy;
56 }
57 struct _N45
58 {
59     DWORD __bitfield1;
60     DWORD NameOffset() { return (__bitfield1 >> 0) & 0x7fffffff; }
61     DWORD NameIsString() { return (__bitfield1 >> 31) & 0x1; }
62 }
63 //C      DWORD Name;
64 //C      WORD Id;
65 //C           } ;
66 union _N44
67 {
68     DWORD __bitfield1;
69     DWORD NameOffset() { return (__bitfield1 >> 0) & 0x7fffffff; }
70     DWORD NameIsString() { return (__bitfield1 >> 31) & 0x1; }
71     DWORD Name;
72     WORD Id;
73 }
74 struct _N47
75 {
76     DWORD __bitfield1;
77     DWORD OffsetToDirectory() { return (__bitfield1 >> 0) & 0x7fffffff; }
78     DWORD DataIsDirectory() { return (__bitfield1 >> 31) & 0x1; }
79 }
80 //C           } ;
81 union _N46
82 {
83     DWORD OffsetToData;
84     DWORD OffsetToDirectory() { return 0x7fffffff; }
85     DWORD DataIsDirectory() { return 0x1; }
86 }
87 struct _IMAGE_RESOURCE_DIRECTORY_ENTRY
88 {
89     DWORD __bitfield1;
90     DWORD NameOffset() { return (__bitfield1 >> 0) & 0x7fffffff; }
91     DWORD NameIsString() { return (__bitfield1 >> 31) & 0x1; }
92     DWORD Name;
93     WORD Id;
94     DWORD OffsetToData;
95     DWORD OffsetToDirectory() { return (__bitfield1 >> 0) & 0x7fffffff; }
96     DWORD DataIsDirectory() { return (__bitfield1 >> 31) & 0x1; }
97 }
98 struct _IMAGE_CE_RUNTIME_FUNCTION_ENTRY
99 {
100     DWORD FuncStart;
101     DWORD __bitfield1;
102     DWORD PrologLen() { return (__bitfield1 >> 0) & 0xff; }
103     DWORD FuncLen() { return (__bitfield1 >> 8) & 0x3fffff; }
104     DWORD ThirtyTwoBit() { return (__bitfield1 >> 30) & 0x1; }
105     DWORD ExceptionFlag() { return (__bitfield1 >> 31) & 0x1; }
106 }
107 struct _FPO_DATA
108 {
109     DWORD ulOffStart;
110     DWORD cbProcSize;
111     DWORD cdwLocals;
112     WORD cdwParams;
113     WORD __bitfield1;
114     WORD cbProlog() { return (__bitfield1 >> 0) & 0xff; }
115     WORD cbRegs() { return (__bitfield1 >> 8) & 0x7; }
116     WORD fHasSEH() { return (__bitfield1 >> 11) & 0x1; }
117     WORD fUseBP() { return (__bitfield1 >> 12) & 0x1; }
118     WORD reserved() { return (__bitfield1 >> 13) & 0x1; }
119     WORD cbFrame() { return (__bitfield1 >> 14) & 0x3; }
120 }
121 struct _ImageArchitectureHeader
122 {
123     uint __bitfield1;
124     uint AmaskValue() { return (__bitfield1 >> 0) & 0x1; }
125     int Adummy1() { return (__bitfield1 << 24) >> 25; }
126     uint AmaskShift() { return (__bitfield1 >> 8) & 0xff; }
127     int Adummy2() { return (__bitfield1 << 0) >> 16; }
128     DWORD FirstEntryRVA;
129 }
130 struct IMPORT_OBJECT_HEADER
131 {
132     WORD Sig1;
133     WORD Sig2;
134     WORD Version;
135     WORD Machine;
136     DWORD TimeDateStamp;
137     DWORD SizeOfData;
138     WORD Ordinal;
139     WORD Hint;
140     WORD __bitfield1;
141     WORD Type() { return (__bitfield1 >> 0) & 0x3; }
142     WORD NameType() { return (__bitfield1 >> 2) & 0x7; }
143     WORD Reserved() { return (__bitfield1 >> 5) & 0x7ff; }
144 }
145 struct _COMSTAT
146 {
147     DWORD __bitfield1;
148     DWORD fCtsHold() { return (__bitfield1 >> 0) & 0x1; }
149     DWORD fDsrHold() { return (__bitfield1 >> 1) & 0x1; }
150     DWORD fRlsdHold() { return (__bitfield1 >> 2) & 0x1; }
151     DWORD fXoffHold() { return (__bitfield1 >> 3) & 0x1; }
152     DWORD fXoffSent() { return (__bitfield1 >> 4) & 0x1; }
153     DWORD fEof() { return (__bitfield1 >> 5) & 0x1; }
154     DWORD fTxim() { return (__bitfield1 >> 6) & 0x1; }
155     DWORD fReserved() { return (__bitfield1 >> 7) & 0x1ffffff; }
156     DWORD cbInQue;
157     DWORD cbOutQue;
158 }
159 struct _DCB
160 {
161     DWORD DCBlength;
162     DWORD BaudRate;
163     DWORD __bitfield1;
164     DWORD fBinary() { return (__bitfield1 >> 0) & 0x1; }
165     DWORD fParity() { return (__bitfield1 >> 1) & 0x1; }
166     DWORD fOutxCtsFlow() { return (__bitfield1 >> 2) & 0x1; }
167     DWORD fOutxDsrFlow() { return (__bitfield1 >> 3) & 0x1; }
168     DWORD fDtrControl() { return (__bitfield1 >> 4) & 0x3; }
169     DWORD fDsrSensitivity() { return (__bitfield1 >> 6) & 0x1; }
170     DWORD fTXContinueOnXoff() { return (__bitfield1 >> 7) & 0x1; }
171     DWORD fOutX() { return (__bitfield1 >> 8) & 0x1; }
172     DWORD fInX() { return (__bitfield1 >> 9) & 0x1; }
173     DWORD fErrorChar() { return (__bitfield1 >> 10) & 0x1; }
174     DWORD fNull() { return (__bitfield1 >> 11) & 0x1; }
175     DWORD fRtsControl() { return (__bitfield1 >> 12) & 0x3; }
176     DWORD fAbortOnError() { return (__bitfield1 >> 14) & 0x1; }
177     DWORD fDummy2() { return (__bitfield1 >> 15) & 0x1ffff; }
178     WORD wReserved;
179     WORD XonLim;
180     WORD XoffLim;
181     BYTE ByteSize;
182     BYTE Parity;
183     BYTE StopBits;
184     char XonChar;
185     char XoffChar;
186     char ErrorChar;
187     char EofChar;
188     char EvtChar;
189     WORD wReserved1;
190 }
191 struct tagMENUBARINFO
192 {
193     DWORD cbSize;
194     RECT rcBar;
195     HMENU hMenu;
196     HWND hwndMenu;
197     WINBOOL __bitfield1;
198     WINBOOL fBarFocused() { return (__bitfield1 << 31) >> 31; }
199     WINBOOL fFocused() { return (__bitfield1 << 30) >> 31; }
200 }
201 struct _N88
202 {
203     ushort __bitfield1;
204     ushort bAppReturnCode() { return (__bitfield1 >> 0) & 0xff; }
205     ushort reserved() { return (__bitfield1 >> 8) & 0x3f; }
206     ushort fBusy() { return (__bitfield1 >> 14) & 0x1; }
207     ushort fAck() { return (__bitfield1 >> 15) & 0x1; }
208 }
209 struct _N89
210 {
211     ushort __bitfield1;
212     ushort reserved() { return (__bitfield1 >> 0) & 0x3fff; }
213     ushort fDeferUpd() { return (__bitfield1 >> 14) & 0x1; }
214     ushort fAckReq() { return (__bitfield1 >> 15) & 0x1; }
215     short cfFormat;
216 }
217 struct _N90
218 {
219     ushort __bitfield1;
220     ushort unused() { return (__bitfield1 >> 0) & 0xfff; }
221     ushort fResponse() { return (__bitfield1 >> 12) & 0x1; }
222     ushort fRelease() { return (__bitfield1 >> 13) & 0x1; }
223     ushort reserved() { return (__bitfield1 >> 14) & 0x1; }
224     ushort fAckReq() { return (__bitfield1 >> 15) & 0x1; }
225     short cfFormat;
226     BYTE [1]Value;
227 }
228 struct _N91
229 {
230     ushort __bitfield1;
231     ushort unused() { return (__bitfield1 >> 0) & 0x1fff; }
232     ushort fRelease() { return (__bitfield1 >> 13) & 0x1; }
233     ushort fReserved() { return (__bitfield1 >> 14) & 0x3; }
234     short cfFormat;
235     BYTE [1]Value;
236 }
237 struct _N92
238 {
239     ushort __bitfield1;
240     ushort unused() { return (__bitfield1 >> 0) & 0x1fff; }
241     ushort fRelease() { return (__bitfield1 >> 13) & 0x1; }
242     ushort fDeferUpd() { return (__bitfield1 >> 14) & 0x1; }
243     ushort fAckReq() { return (__bitfield1 >> 15) & 0x1; }
244     short cfFormat;
245 }
246 struct _N93
247 {
248     ushort __bitfield1;
249     ushort unused() { return (__bitfield1 >> 0) & 0xfff; }
250     ushort fAck() { return (__bitfield1 >> 12) & 0x1; }
251     ushort fRelease() { return (__bitfield1 >> 13) & 0x1; }
252     ushort fReserved() { return (__bitfield1 >> 14) & 0x1; }
253     ushort fAckReq() { return (__bitfield1 >> 15) & 0x1; }
254     short cfFormat;
255     BYTE [1]rgb;
256 }
257 struct _MIDL_STUB_MESSAGE
258 {
259     PRPC_MESSAGE RpcMsg;
260     ubyte *Buffer;
261     ubyte *BufferStart;
262     ubyte *BufferEnd;
263     ubyte *BufferMark;
264     uint BufferLength;
265     uint MemorySize;
266     ubyte *Memory;
267     ubyte IsClient;
268     ubyte Pad;
269     ushort uFlags2;
270     int ReuseBuffer;
271     NDR_ALLOC_ALL_NODES_CONTEXT *pAllocAllNodesContext;
272     NDR_POINTER_QUEUE_STATE *pPointerQueueState;
273     int IgnoreEmbeddedPointers;
274     ubyte *PointerBufferMark;
275     ubyte fBufferValid;
276     ubyte uFlags;
277     ushort UniquePtrCount;
278     ULONG_PTR MaxCount;
279     uint Offset;
280     uint ActualCount;
281     void * function(size_t )pfnAllocate;
282     void  function(void *)pfnFree;
283     ubyte *StackTop;
284     ubyte *pPresentedType;
285     ubyte *pTransmitType;
286     handle_t SavedHandle;
287     _MIDL_STUB_DESC *StubDesc;
288     _FULL_PTR_XLAT_TABLES *FullPtrXlatTables;
289     uint FullPtrRefId;
290     uint PointerLength;
291     int __bitfield1;
292     int fInDontFree() { return (__bitfield1 << 31) >> 31; }
293     int fDontCallFreeInst() { return (__bitfield1 << 30) >> 31; }
294     int fInOnlyParam() { return (__bitfield1 << 29) >> 31; }
295     int fHasReturn() { return (__bitfield1 << 28) >> 31; }
296     int fHasExtensions() { return (__bitfield1 << 27) >> 31; }
297     int fHasNewCorrDesc() { return (__bitfield1 << 26) >> 31; }
298     int fIsOicfServer() { return (__bitfield1 << 25) >> 31; }
299     int fHasMemoryValidateCallback() { return (__bitfield1 << 24) >> 31; }
300     int fUnused() { return (__bitfield1 << 16) >> 24; }
301     int fUnused2() { return (__bitfield1 << 0) >> 16; }
302     uint dwDestContext;
303     void *pvDestContext;
304     NDR_SCONTEXT *SavedContextHandles;
305     int ParamNumber;
306     IRpcChannelBuffer *pRpcChannelBuffer;
307     PARRAY_INFO pArrayInfo;
308     uint *SizePtrCountArray;
309     uint *SizePtrOffsetArray;
310     uint *SizePtrLengthArray;
311     void *pArgQueue;
312     uint dwStubPhase;
313     void *LowStackMark;
314     PNDR_ASYNC_MESSAGE pAsyncMsg;
315     PNDR_CORRELATION_INFO pCorrInfo;
316     ubyte *pCorrMemory;
317     void *pMemoryList;
318     CS_STUB_INFO *pCSInfo;
319     ubyte *ConformanceMark;
320     ubyte *VarianceMark;
321     INT_PTR Unused;
322     _NDR_PROC_CONTEXT *pContext;
323     void *pUserMarshalList;
324     INT_PTR Reserved51_2;
325     INT_PTR Reserved51_3;
326     INT_PTR Reserved51_4;
327     INT_PTR Reserved51_5;
328 }
329 //C         return _Ptr;
330 pure HWND HWND_TOP() {return cast(HWND)0;}
331 pure WORD LOWORD(T)(T l) {return cast(WORD)((cast(DWORD_PTR)l) & 0xffff);}
332 pure WORD HIWORD(T)(T l) {return cast(WORD)((cast(DWORD_PTR)l) >> 16);}
333 pure short GET_WHEEL_DELTA_WPARAM(DWORD wParam) {return cast(short)HIWORD(wParam);}
334 static if (__traits(compiles, typeof(_CONST_RETURN))) static if (!__traits(isStaticFunction, _CONST_RETURN)) static if (__traits(isPOD, typeof(_CONST_RETURN))) const _WConst_return = _CONST_RETURN;